package kr.hkit.powerjava.chapter06;

import java.util.Scanner;

/*
 * 피보나치 수열 f0=0, f1=1 fi+1 = fi + fi-1
 */
public class Programming10 {

	public static void main(String[] args) {
		
		Scanner input = new Scanner(System.in);
		long a = 0, b= 1, c;
		int i;
		
		System.out.print("몇 번째 항까지 출력할까요?: ");
		int num = input.nextInt();
		
		System.out.printf("%d %d", a, b);
		
		for(i = 2; i <= num; i++){
			c = a + b;
			a = b;
			b = c;
			System.out.printf(" %d", c);
		}
		
	}
}
